package wwk.common.phone;

import wwk.common.constant.Commonstant;
import wwk.common.event.MessageManager;
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Message;
import android.util.Log;

/*
 * 1.���ȿ���������ϵͳ�ᷢ��һ��Standard Broadcast Action��
 *    ���ֽ�android.intent.action.BOOT_COMPLETED�����Actionֻ�ᷢ��һ�Ρ�
 * 2.����һ��BroadcastReceiver�࣬�ع�����󷽷�onReceive(Context context, Intent intent)��
 *         ��������������Ҫ������Service��
 * 3.��AndroidManifest.xml�У����ȼ���
 *    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"></uses-permission>
 *    �����BOOT_COMPLETED��ʹ����ɣ�Ȼ��ע��ǰ���ع���IntentReceiver�࣬
 *    ����<intent-filter>�м���<action android:name="android.intent.action.BOOT_COMPLETED" /> ��
 *    ��ʹ���ܲ�׽�����Action��    
 * �ο��ĵ� http://www.cnblogs.com/ssqjd/archive/2009/02/08/1386460.html
 */
 public class StartReceiver extends BroadcastReceiver 
 {
	public void onReceive(Context context, Intent intent) 
	{
		Log.d("StartReceiver onReceive",intent.getAction());
		
		if (intent.getAction().equals(Intent.ACTION_NEW_OUTGOING_CALL)) 
		{
			//ȥ��
			String phoneNumber = intent.getStringExtra(Intent.EXTRA_PHONE_NUMBER);
			//SpeakManager.outGoingPhoneNumber=phoneNumber;
			
			//֪ͨ
			////HandlerCenter.instance().setContext(context);			
			MessageManager.instance().sendMessage(Commonstant.Message_Phone_Outcall,
					phoneNumber);
		}
	}
 }
